import requests


class EmpMnage(object):
    def add_emp(self, req_head, req_data):
        resp = requests.post(url="http://ihrm2-test.itheima.net/api/sys/user", headers=req_head, json=req_data)
        return resp

    def query_emp(self, emp_id, req_head):
        resp = requests.get(url="http://ihrm2-test.itheima.net/api/sys/user" + emp_id, headers=req_head)
        return resp

    def modify_emp(self, emp_id, req_head, req_data):
        resp = requests.put(url="http://ihrm2-test.itheima.net/api/sys/user" + emp_id, headers=req_head, json=req_data)
        return resp

    def delete_emp(self, emp_id, req_head):
        resp = requests.get(url="http://ihrm2-test.itheima.net/api/sys/user" + emp_id, headers=req_head)
        return resp
if __name__ == '__main__':
    emp = EmpMnage()
    # req_head = {"Content-Type":"application/json","Authorization":"3905295c-342e-4726-a81f-de97b3e0bc87"}
    # req_body = {"username": "阿达西","mobile": "13438749800","workNumber": "1010"}
    # ret = emp.add_emp(req_head, req_body)
    # print(ret.json())
    req_head = {"Authorization":"3905295c-342e-4726-a81f-de97b3e0bc87"}
    emp_id = "1570687778608394240"
    ret = emp.query_emp(emp_id, req_head)
    print(ret.json())
    # req_data = {"username": "阿达西4"}
    # ret = emp.modify_emp(emp_id, req_head, req_data)
    # print(ret.json())